int autoupdate(char* url_address, char* local_to_file)
{// addr = 0x0804D64E
    int sockfd;
    char[1023] buffer;
    struct sockaddr_in server_addr;
    struct hostent* host;
    int portnumber;
    int nbytes;
    char[255] host_addr;
    char[1023] host_file;
    char[255] local_file;
    FILE* fp;
    char[1023] request;
    int send;
    int totalsend;
    int i;
    char* pt;
    fd_set rsetfds;
    struct timeval tv;
    int __d0;
    int __d1;
    int nOnline;
    char __result;
    signed int _v16;
    intOrPtr _v20;
    int _v24;
    signed int _v28;
    signed int _v32;
    int _v36;
    int _v40;
    char* _v44;
    intOrPtr _v48;
    signed int _v52;
    char* _v56;
    signed int _v1080;
    intOrPtr _v1092;
    short _v1094;
    char _v1096;
    signed int _v1100;
    char _v1356;
    signed int _v2380;
    char _v2636;
    char _v3660;
    char _v3788;
    int _v3792;
    char _v3796;
    int _v3808;
    signed int _v3820;
    char* _v3824;
    int _v3828;
    char* _v3832;
    _unknown_ r6;
    signed int _t163;
    short _t167;
    _unknown_ _t174;
    _unknown_ _t181;
    _unknown_ _t184;
    intOrPtr _t186;
    int _t193;
    char* _t197;
    _unknown_ _t198;
    _unknown_ _t199;
    _unknown_ _t202;
    signed int _t206;
    _unknown_ _t209;
    intOrPtr _t213;
    _unknown_ _t217;
    intOrPtr* _t225;
    _unknown_ _t229;
    _unknown_ _t235;
    _unknown_ _t239;
    _unknown_ _t246;
    char* _t248;
    intOrPtr* _t249;
    intOrPtr* _t251;
    intOrPtr* _t253;
    _unknown_ _t255;
    _unknown_ _t256;
    _unknown_ _t258;
    _unknown_ _t259;
    _unknown_ _t264;
    _unknown_ _t267;
    _unknown_ _t271;
    char* _t272;

    GetHost(url_address,  &_v1356,  &_v2380,  &_v1100);
    L0805FF20("webhost:[%s]\n",  &_v1356);
    L0805FF20("hostfile:[%s]\n",  &_v2380);
    L0805FF20("portnumber:[%d]\n\n", _v1100);
    _t163 =  &_v1356;
    L08075250(_t163);
    _v52 = _t163;
    __eflags = _v52;
    if(_v52 != 0) {
        _v3828 = 0;
        L08073680(_t255, __esp, 2, 1);
        _v56 = _t163;
        __eflags = _v56 - 255;
        if(_v56 != 255) {
            L0806F910( &_v1096, 16);
            _v1096 = 2;
             *__esp = _v1100 & 65535;
            _t167 = L08075240(__esp);
            _v1094 = _t167;
            _v1092 =  *((intOrPtr*)( *((intOrPtr*)( *((intOrPtr*)(_v52 + 16))))));
            _v3828 = 16;
            _t174 = L08052AA0(__esi, _v56,  &_v1096);
            __eflags = _t174 - 255;
            if(_t174 != 255) {
                _v3820 = _v1100;
                _v3824 =  &_v1356;
//following lines commented out and modified to fix display errors in google code
//see original file for HTTP GET STATEMENT
//                L0805FF50( &_v3660, HTTPGETSTATEMENT,  &_v2380);
                __eflags = _v2380 & 255;
                if((_v2380 & 255) == 0) {
                    _v28 = 0;
                }
L9:
                L0806F850(_t255, _t271, __esi,  &_v2636, 0, 256);
                __eflags = _v28;
                if(_v28 == 0) {
L15:
                    __eflags = _v2380 & 255;
                    if((_v2380 & 255) == 0) {
                        L0806F9E0(_t271, __esi,  &_v2636, "index.html", 11);
                        goto L18;
                    } else {
                        goto L16;
                    }
                    goto L18;
                }
                __eflags =  *_v28 & 255;
                if(( *_v28 & 255) == 0) {
                    goto L15;
                }
                __eflags = _v28 + 1;
                if(__eflags == 0) {
L14:
                    _t235 = L0806E770(__esp, __eflags,  &_v2380);
                    L0806F9E0(_t271, __esi,  &_v2636,  &_v2380, _t235 - 1);
                    goto L18;
                }
                __eflags =  *(_v28 + 1) & 255;
                if(__eflags == 0) {
                    goto L14;
                }
                L0806E520( &_v2636, _v28 + 1);
L18:
                _v40 = 0;
                _v36 = 0;
                 *__esp =  &_v3660;
                _t186 = L0806E770(__esp, __eflags);
                _v48 = _t186;
                while(1) {
                    __eflags = _v36 - _v48;
                    if(_v36 >= _v48) {
                        break;
                    }
                    _t193 = L08052990(_v56,  &_v3660 + _v36, _v48 - _v36);
                    _v40 = _t193;
                    __eflags = _v40 - 255;
                    if(_v40 != 255) {
                        _v36 = _v36 + _v40;
                        continue;
                    }
                    _v3808 = 1;
                    return _v3808;
                }
                L08071740(_t255, __esp, local_to_file);
                _v3832 = "a";
                _t197 = local_to_file;
                 *__esp = _t197;
                L08060B50();
                _v44 = _t197;
                __eflags = _v44;
                if(_v44 != 0) {
                    _v32 = 0;
                    _v3796 = 3;
                    _v3792 = 0;
                    _t272 =  &_v3788;
                    asm("cld ");
                    _push(32 << 2);
                    _push(0);
                    _push(_t272);
                    memset();
                    __esp =  &(__esp[3]);
                    _t273 = _t272 + 32;
                    _v24 = 0;
                    _v20 = _t272 + 32;
                    asm("bts [ebp+edx*4+0xfffff138], eax");
                    while(1) {
L27:
                        L08061340(0, _t273, __esi, "start");
                        _v3820 =  &_v3796;
                        _v3824 = 0;
                        _v3828 =  &_v3788;
                        _t206 =  &_v3788;
                        _v3832 = _t206;
                         *__esp =  &(_v56[1]);
                        L08071940();
                        _v16 = _t206;
                        __eflags = _v16;
                        if(_v16 == 0) {
                            break;
                        }
                        __eflags = _v16;
                        if(_v16 >= 0) {
                            __eflags = _v16;
                            if(__eflags == 0) {
L34:
                                _v3808 = 1;
                                return _v3808;
                            } else {
                                goto L31;
                            }
                            goto L31;
L35:
                            __eflags = _v32 - 3;
                            if(_v32 > 3) {
L40:
                                L08060D80(0, _t273, __esi,  &_v1080, 1, 1, _v44);
                                _v32 = _v32 + 1;
                                __eflags = _v32 & 1023;
                                if((_v32 & 1023) != 0) {
                                    goto L26;
                                } else {
                                    goto L41;
                                }
                                continue;
                            }
                            __eflags = (_v1080 & 255) - 13;
                            if((_v1080 & 255) == 13) {
L38:
                                _v32 = _v32 + 1;
                                continue;
                            }
                            __eflags = (_v1080 & 255) - 10;
                            if((_v1080 & 255) != 10) {
                                _v32 = 0;
                                continue;
                            } else {
                                goto L38;
                            }
                            goto L38;
L41:
                             *__esp = _v44;
                            L08060770();
                            continue;
                        } else {
                            break;
                        }
                        break;
L31:
                        asm("bt [ebp+eax*4+0xfffff138], edx");
                        __eflags = __eflags > 0;
                        if(__eflags == 0) {
                            goto L34;
                        }
                        L08061340(0, _t273, __esi, "aaa");
                        _v3828 = 1;
                        _v3832 =  &_v1080;
                         *__esp = _v56;
                        _t213 = L080529F0();
                        _v48 = _t213;
                        __eflags = _v48 - 1;
                        if(_v48 != 1) {
                            L08061340(0, _t273, __esi, "bbbbb");
                            _v3832 = 493;
                             *__esp = local_to_file;
                            L08071470(0, __esp);
                            L08060220(_v44);
                             *__esp = _v56;
                            L08052A50();
                            _v3808 = 0;
                            return _v3808;
                        }
                        goto L35;
                        return _v3808;
                        goto L35;
                    }
                    L08061340(0, _t273, __esi, "update over time");
                    _v3808 = 1;
                    return _v3808;
                }
                _t225 = L08053180();
                L0806E5A0(_t271, __esi,  *_t225);
                L0805FF20("create file error! %s\n",  *_t225);
                _v3808 = 1;
                return _v3808;
L26:
                goto L27;
L16:
                L0806E520( &_v2636,  &_v2380);
                goto L18;
            } else {
                goto L5;
            }
            goto L5;
L7:
            _t248 = Rstrchr( &_v2380, 47);
            _v28 = _t248;
            goto L9;
        } else {
            goto L3;
        }
        goto L3;
L5:
        _t249 = L08053180();
        L0806E5A0(_t271, __esi,  *_t249);
        L0805FEF0( *135203140, 135043559,  *_t249);
        _v3808 = 1;
        return _v3808;
    }
    _t253 = L08053180();
    L0806E5A0(_t271, __esi,  *_t253);
    L0805FEF0( *135203140, "Gethostname error, %s\n",  *_t253);
    _v3808 = 1;
    return _v3808;
L3:
    _t251 = L08053180();
    L0806E5A0(_t271, __esi,  *_t251);
    L0805FEF0( *135203140, 135043541,  *_t251);
    _v3808 = 1;
    return _v3808;
}